﻿namespace eg_083_抽象类
{
    internal class Program
    {
        // 抽象学生类
        abstract class Student
        {
            public abstract int Authority();    // 抽象获取权限方法
        }

        // 本科生
        class Undergraduate : Student
        {
            public override int Authority()
            {
                return 5;
            }
        }

        class Postgraduate : Student
        {
            public override int Authority() { return 10; }
        }
        class Doctor : Student
        {
            public override int Authority() { return 15; }
        }
        static void Main(string[] args)
        {
            Student Undergraduate = new Undergraduate();        //创建本科生实例
            Console.WriteLine("本科生可以借{0}本书", Undergraduate.Authority());
            Student Postgraduate = new Postgraduate();          //创建硕士生实例
            Console.WriteLine("硕士生可以借{0}本书", Postgraduate.Authority());
            Student Doctor = new Doctor();                      //创建博士生实例
            Console.WriteLine("博士生可以借{0}本书", Doctor.Authority());
        }
    }
}